package com.dailyblue.java.spring.boot.simple.example.handler;

import com.dailyblue.java.spring.boot.commons.bean.JsonResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.web.servlet.error.ErrorController;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Component
@Slf4j
@RequestMapping("/error")
public class MyErrorController implements ErrorController {

    @RequestMapping
    @ResponseBody
    public JsonResult error(){
        log.info("进入了MyErrorController的error方法！");
        return new JsonResult(false,500,"你的代码出现了错误",null);
    }

}
